package com.ccsu.mymarket.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.ccsu.mymarket.entity.OrderInfo;
import com.ccsu.mymarket.entity.Role;
import com.ccsu.mymarket.entity.message.Result;
import com.ccsu.mymarket.exception.MyException;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.List;
import java.util.Map;

public interface OrderService extends IService<OrderInfo> {

    List<OrderInfo> getOrderList();

    Double checkUserPurse(Integer id,Double sum);

    Integer checkBookStock(Integer id,Integer num);

    /**
     * 购物车下单
     *
     * @param bookIds 商品id列表
     * @param userId 用户id
     * @return 操作是否成功
     */
    boolean batchAddOrder(List<Integer> bookIds,Integer userId) throws MyException;

    Result updateOrder(OrderInfo order);

    List<Map> getComments(Integer id);

    /**
     * 传入id后,根据用户身份查询订单
     * @param id 用户id
     * @return
     */
    List<OrderInfo> getOrderByUserId(Integer id);
}
